package com.bRoom.util;

import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;

public class PropertiesUtil {

    private static Properties pro;



    static {

        String file="mmall.properties";
        pro=new Properties();
        try {
            pro.load(new InputStreamReader(PropertiesUtil.class.getClassLoader().getResourceAsStream(file),"utf-8"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public  static  String getProperties(String key){
        String value=pro.getProperty(key.trim());
        if (value==null){
             return null;
        }
        return value.trim();
    }

    public static  String  getProperties(String key,String defaultValue){
         String value=pro.getProperty(key);
         if (value==null){
              value=defaultValue.trim();
         }
         return value.trim();
    }
}
